var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("d_monster_item"),
    r = e("monster_node_info"),
    s = e("node_team"),
    l = e("role_node"),
    _ = e("team_node_info"),
    c = e("tower_node_info"),
    d = cc._decorator,
    h = d.ccclass,
    u =
        (d.property,
            (function (e) {
                function t() {
                    var t = (null !== e && e.apply(this, arguments)) || this;
                    return (t.role_info = null), (t.team_info = 0), t;
                }
                return (
                    nn(t, e),
                    (t.prototype.initView = function () {
                        (this.role_info = this.node.parent.getComponent(l.default)),
                            (this.team_info = this.node.parent.getComponent(s.default).getTeamInfo());
                    }),
                    (t.prototype.onCollisionEnter = function (e, t) {
                        var o = e.node,
                            a = o.group;
                        if (1 == t.tag && 0 == e.tag)
                            if ("soldier" == a) {
                                var d = o.getComponent(_.default);
                                d.team_info != this.team_info &&
                                    d.soldierBeHit(
                                        this.role_info.getRoleSkillAttack(t.tag),
                                        this.role_info.match_game_index
                                    );
                            } else
                                "role" == a || "tower" == a
                                    ? o.getComponent(s.default).getTeamInfo() != this.team_info &&
                                    ("role" == a
                                        ? o
                                            .getComponent(l.default)
                                            .roleBeHit(
                                                this.role_info.getRoleSkillAttack(t.tag),
                                                this.role_info.match_game_index
                                            )
                                        : "tower" == a &&
                                        o
                                            .getComponent(c.default)
                                            .towerBeHit(
                                                this.role_info.getRoleSkillAttack(t.tag),
                                                this.role_info.match_game_index
                                            ))
                                    : "monster" == a &&
                                    (2 != n.GlobalParams.MultiModeIndex
                                        ? o
                                            .getComponent(r.default)
                                            .attackMonster(
                                                this.role_info.getRoleSkillAttack(t.tag),
                                                this.role_info.match_game_index,
                                                this.node.parent
                                            )
                                        : o
                                            .getComponent(i.default)
                                            .attackMonster(this.role_info.getRoleSkillAttack(t.tag)));
                    }),
                    oo([h], t)
                );
            })(a.default));
o.default = u;
